package com.hc.dfs.activity;

import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.Button;
import android.widget.ScrollView;
import android.widget.TableLayout;

import com.hc.dfs.activity.R;
import com.hc.dfs.anim.CommonGesture;
import com.hc.dfs.dailog.SecretDialog;

/**
 * @author 王洪胜 E-mail:
 * @version 创建时间：2013-2-25 上午9:13:35
 * 
 *          类说明：
 * 
 */
public class SigningOperationActivity extends BaseActivity {

	private Button shoujianren;
	private Button miji;
	private Button submit;
	private Button back;
	private ScrollView sv;
	private TableLayout tab;
	private CommonGesture cg;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.signing_operation);
		initView();
	}

	//初始化控件并绑定监听器
	public void initView(){
		sv = (ScrollView) findViewById(R.id.scroller_wrap);
		tab = (TableLayout) findViewById(R.id.tab_wrap);
		cg = new CommonGesture(1, this, null, 0, 0, 1, R.anim.translate0_0, R.anim.translate0_100_300);
		back = (Button) findViewById(R.id.button1);
		shoujianren = (Button) findViewById(R.id.shoujianren2);
		miji = (Button) findViewById(R.id.miji2);
		submit = (Button) findViewById(R.id.submit);
		
		back.setOnClickListener(this);
		shoujianren.setOnClickListener(this);
		miji.setOnClickListener(this);
		submit.setOnClickListener(this);
		sv.setOnTouchListener(new OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				tab.dispatchTouchEvent(event);
				return false;
			}
		});
		tab.setOnTouchListener(new OnTouchListener() {
			
			@Override
			public boolean onTouch(View v, MotionEvent event) {
				// TODO Auto-generated method stub
				return cg.getGd().onTouchEvent(event);
			}
		});
	}
	
	@Override
	public void onClick(View v) {
		int id = v.getId();
		switch (id) {
		case R.id.button1:
			//返回
			finish();
			break;
		case R.id.shoujianren2:
			//跳转到通讯录
			startActivity(new Intent(SigningOperationActivity.this, ContactActivity.class));
			break;
		case R.id.miji2:
			new SecretDialog(R.layout.secret_dialog, this);
			break;
		case R.id.submit:
			System.out.println("提交操作");
			break;

		default:
			break;
		}
	}

	@Override
	public void init() {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void refresh(Object... param) {
		// TODO Auto-generated method stub
		
	}

}
